@extends('layouts.header')
@section('title','添加带电作业检测项目')
@section('content')
    <article class="page-container">
        <label><input type="checkbox" id="checkbox">连续操作</label>
        <form id="form" class="form form-horizontal">
            <div class="row cl">
                <label class="form-label col-xs-2">带电作业检测项目ID：</label>
                <div class="formControls col-xs-8">
                    <input name="ddzy_id" class="select2 input-text required"/>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-2">带电作业检测项目：</label>
                <div class="formControls col-xs-8">
                    <input name="name" class="select2 input-text required" maxlength="30" />
                </div>
            </div>
            <!-- <div class="row cl">
                <label class="form-label col-xs-2">映射本系统项目：</label>
                <div class="formControls col-xs-8">
                    <select name="testitem_name" class="select2 input-text" style="width:80%;">
                        @foreach($data['testitem'] as $val )
                        <option value="{{$val}}">{{$val}}</option>
                        @endforeach
                    </select>
                </div>
            </div> -->
            <div class="row cl text-c">
                <a class="btn btn-primary radius" onclick="addSub()">确定</a>
            </div>
        </form>
    </article>
    <script type="text/javascript">
        $(function () {
            $('.select2').select2();
        })
        function addSub(){
            if ($('#form').valid()) {
                ajax('post','',$('#form').serialize(),addSubBak);
                function addSubBak(res){
                    let checked = $('#checkbox').prop('checked');
                    if (!checked && parseInt(res) === 1) {
                        parent.location.reload();
                    }
                }
            }
        }
    </script>
@endsection